package com.example.mqltest.controler;

import com.example.mqltest.entity.Result;
import com.example.mqltest.entity.Student;
import com.example.mqltest.service.CourseService;
import com.example.mqltest.service.StudentService;
import com.example.mqltest.service.serviceImp.CourseServiceImp;
import com.example.mqltest.service.serviceImp.StudentServiceImp;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @Autowired
    CourseService courseService;

    @PostMapping("/register")
    public Result registerStudent(@RequestBody Student student){
        return studentService.registerStudent( student );
    }

    //退课
    @GetMapping("exitCourse")
    public Result exitCourse(@Param( "studentId" )String studentId,@Param( "courseCode" )String courseCode){
        return studentService.exitCourse( studentId,courseCode );
    }
    //加课
    @GetMapping("joinCourse")
    public Result joinCourse(@Param( "studentId" )String studentId,@Param( "courseCode" )String courseCode){
        return studentService.joinCourse( studentId,courseCode );
    }

}
